﻿// <copyright file="FormTrackerAttribute.cs" company="Microsoft Corporation">
// Copyright (c) 2009 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2009-11-27</date>
// <summary>FormTrackerAttribute class definition</summary>

namespace Microsoft.WebAnalytics.Contracts
{
    using System;
    using System.ComponentModel.Composition;

    /// <summary>
    /// Attribute for custom tracking of a form control type
    /// </summary>
    [MetadataAttribute]
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    public sealed class FormTrackerAttribute : ExportAttribute, ITrackerMetadata
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the FormTrackerAttribute class.
        /// </summary>
        /// <param name="objectType">the control type</param>
        public FormTrackerAttribute(Type objectType) :
            base(typeof(ITrackFormControl))
        {
            this.ObjectType = objectType;
        }
        #endregion

        #region ITrackerMetadata Members

        /// <summary>
        /// Gets the object type
        /// </summary>
        public Type ObjectType { get; private set; }

        #endregion
    }
}
